<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>会员信息</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <meta name="apple-touch-fullscreen" content="YES">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <!--<link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/animate.css/3.5.2/animate.min.css">-->
    <link rel="stylesheet" type="text/css" href="/Public/projects/member/libs/animate.css">
    <link rel="stylesheet" type="text/css" href="/Public/projects/member/libs/material.css">
    <link rel="stylesheet" type="text/css" href="/Public/projects/member/style/base.css">
    <link rel="stylesheet" type="text/css" href="/Public/projects/member/style/index.css">
    <!-- <link rel="stylesheet/less" type="text/css" href="/Public/projects/member/style/index.less"> -->
    <link rel="stylesheet" type="text/css" href="/Public/projects/member/style/LArea.css">

    <style>
        html,body{
            height:100%;
            width:100%;
        }
    </style>
</head>
<body>

<div class="content">

    <div class="layout-title layout-blank10"></div>
    <div class="layout-title layout-blank10"></div>
    <div class="layout-title layout-blank10"></div>
    <div class="item-center">
        <img src="/Public/projects/member/assets/image/img_head.png">
    </div>
    <div class="layout-title layout-blank10"></div>
    <div class="item-center">
        <span class="name" id="name">新媒体</span>
    </div>
    <div class="layout-title layout-blank10"></div>
    <div class="item-center">
        <span class="address" id="address">地址</span>
    </div>

    <div class="content-box-wrapper">

    </div>

    <div class="layout-blank10"></div>
    <div class="item-left btn">
        <button id="select-member" class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-js-ripple-effect">
            <i class="sprite ico-15"></i>
        </button>
        <span class="member-item">选择会员套餐</span>
    </div>

</div>


<script src="/Public/projects/member/libs/jquery-3.1.1.js"></script>
<!-- <script src="/Public/projects/member/libs/less.js"></script> -->
<script src="/Public/projects/member/libs/material.js"></script>
<!--common of all js file-->
<script src="/Public/projects/member/js/common.js"></script>
<!--add self scrip file-->

<script>
    $(function () {

        var name ,phone ;

        var t_item = '<div class="content-box for-info">\
                <div class="info-item">\
                <span class="icon"></span>\
                <span class="text"></span>\
                <span class="date"></span>\
                </div>\
                </div>';

        var contextId = ns.getLocationParams()["id"];
        $("input").on("focus",function () {
            $(this).next("label").addClass("focus");
        });
        $("input").on("blur",function () {
            $(this).next("label").removeClass("focus");
        });
        $(".apply_success").hide();

        ns.ajax({
            url:"getDetail",
            type: "GET",
            data:{
                id: contextId
            }
            ,success:function (result) {
                updateItems(result["member_class"]);
                var member = result["member"];
                var keys = Object.keys(member);
                updateInfo(member[keys[0]]);
            }
        });
        function updateItems(items) {
            var $wrapper = $(".content-box-wrapper");
            $wrapper.empty();
            for(var i=0, len=items.length; i<len ;i++){
                var item = items[i];
                $wrapper.append(t_item);
                var $item = $wrapper.children().last();
                $item.find(".text").html(item["name"]);
            }
        }
        function updateInfo(info) {
            $("#address").html(
                    info["province_name"] + " "
                    + info["city_name"] + " "
                    + info["district_name"] + " "
                    + info["address"]
            );
            $("#name").html(info["name"]);
            name = info["name"];
            phone = info["phone"];
        }

        $("#select-member").tap(function (e) {
           var url = ns.genServerApiUrl("index?id=" + contextId+"&page=2"+"&name="+name+"&phone="+phone);
            // var url = "apply.html?id=1";
            ns.navigate(url);
        });
    });
</script>

<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?80e42c68052dc7b0d359cd50f98083d3";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>